Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(grouping): Exception Groups #48653

Merged
merged 16 commits into from
May 22, 2023

Conversation

mattjohnsonpint
Copy link
Contributor

@mattjohnsonpint mattjohnsonpint commented May 5, 2023

Implements issue grouping and titling changes required for processing exception groups per Sentry RFC 79.

Part of #37716

A few notes:

  • The issue titling requirements were implemented by dropping a main_exception_id on the event data in the exception grouping logic, and then later using it in the ErrorEvent.extract_metadata function. If present, it uses the corresponding exception for metadata including the title. This is working well, but just wanted to check if this is safe, or if there's a better way.

  • In the RFC, I had indicated that disparate top-level exceptions would be grouped under their immediate parent exception, which might not necessarily be the root exception. This turned out to be difficult to implement, and didn't add much value. Instead, I always use the root exception. This seems to work well enough. I included a comment at the appropriate place in the code, in case it comes up in the future.

  • I only modified the NewStyle strategy. I'm not sure if Legacy or other strategies should be updated as well?

  • I fixed a related bug in exception.py, which was that the first exception was being used to create default issue tags instead of the last. This should be done regardless of exception groups, as it corrects the handled and mechanism event tags such that they are for the outermost (latest) exception. Tests are updated to match this change as well.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label May 5, 2023
Copy link
Member

@untitaker untitaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to ignore everything prefixed with nit, those are just random thoughts.

src/sentry/grouping/strategies/newstyle.py Outdated Show resolved Hide resolved
src/sentry/grouping/strategies/newstyle.py Outdated Show resolved Hide resolved
src/sentry/grouping/strategies/newstyle.py Outdated Show resolved Hide resolved
src/sentry/grouping/strategies/newstyle.py Outdated Show resolved Hide resolved
src/sentry/grouping/strategies/newstyle.py Show resolved Hide resolved
src/sentry/grouping/strategies/newstyle.py Outdated Show resolved Hide resolved
src/sentry/grouping/strategies/newstyle.py Show resolved Hide resolved
@codecov
Copy link

codecov bot commented May 19, 2023

Codecov Report

Merging #48653 (2b1c043) into master (865836e) will increase coverage by 2.52%.
The diff coverage is 92.30%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #48653      +/-   ##
==========================================
+ Coverage   78.47%   80.99%   +2.52%     
==========================================
  Files        4816     4817       +1     
  Lines      202076   202142      +66     
  Branches    11369    11369              
==========================================
+ Hits       158579   163728    +5149     
+ Misses      43243    38160    -5083     
  Partials      254      254              
Impacted Files Coverage Δ
src/sentry/api/endpoints/project_team_details.py 100.00% <ø> (+6.45%) ⬆️
...atic/app/utils/requestError/createRequestError.tsx 11.11% <ø> (ø)
static/app/views/issueDetails/actions/index.tsx 50.00% <ø> (ø)
...nce/landing/widgets/components/widgetContainer.tsx 83.75% <ø> (ø)
static/app/views/settings/project/projectTeams.tsx 74.41% <ø> (-1.67%) ⬇️
src/sentry/interfaces/exception.py 82.51% <66.66%> (-0.70%) ⬇️
src/sentry/grouping/strategies/newstyle.py 98.43% <92.72%> (+7.12%) ⬆️
src/sentry/eventtypes/error.py 97.82% <100.00%> (-2.18%) ⬇️

... and 321 files with indirect coverage changes

@mattjohnsonpint mattjohnsonpint merged commit f4fa54e into master May 22, 2023
@mattjohnsonpint mattjohnsonpint deleted the feat/issue-grouping-for-exception-groups branch May 22, 2023 15:50
volokluev pushed a commit that referenced this pull request May 30, 2023
Implements issue grouping and titling changes required for processing
exception groups per [Sentry RFC
79](https://github.com/getsentry/rfcs/blob/main/text/0079-exception-groups.md#sentry-issue-grouping).

Part of #37716

A few notes:

- The issue titling requirements were implemented by dropping a
`main_exception_id` on the event data in the exception grouping logic,
and then later using it in the `ErrorEvent.extract_metadata` function.
If present, it uses the corresponding exception for metadata including
the title. This is working well, but just wanted to check if this is
safe, or if there's a better way.

- In the RFC, I had indicated that disparate top-level exceptions would
be grouped under their immediate parent exception, which might not
necessarily be the root exception. This turned out to be difficult to
implement, and didn't add much value. Instead, I always use the root
exception. This seems to work well enough. I included a comment at the
appropriate place in the code, in case it comes up in the future.

- I only modified the `NewStyle` strategy. I'm not sure if `Legacy` or
other strategies should be updated as well?

- I fixed a related bug in `exception.py`, which was that the first
exception was being used to create default issue tags instead of the
last. This should be done regardless of exception groups, as it corrects
the `handled` and `mechanism` event tags such that they are for the
outermost (latest) exception. Tests are updated to match this change as
well.
@github-actions github-actions bot locked and limited conversation to collaborators Jun 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants